# This is a sample Python script.

# Press ⌃R to execute it or replace it with your code.
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
import pandas as pd
from collections import Counter

def print_hi(name):
    # Use a breakpoint in the code line below to debug your script.
    print(f'Hi, {name}')  # Press ⌘F8 to toggle the breakpoint.

def bahceli_refugees_tweets_reactions():
    # Replace 'file_path' with the actual path to your Excel file
    df = pd.read_excel('/Users/AyseEsra/Desktop/FilteredTweets/Refugees/Bahceli/BahceliFilteredTweets.xlsx')

    retweet_count_general=0
    reply_count_general=0
    like_count_general=0
    quote_count_general=0

    # Iterate over each row in the Excel file
    for index, row in df.iterrows():
        retweet_count = row['retweet_count']
        reply_count = row['reply_count']
        like_count = row['like_count']
        quote_count = row['quote_count']

        retweet_count_general += retweet_count
        reply_count_general += reply_count
        like_count_general += like_count
        quote_count_general += quote_count

    num_rows = df.shape[0]

    print("Bahceli Refugees Reactions")
    print(f"Average retweet_count is  {retweet_count_general / num_rows } ")
    print(f"Average reply_count is  {reply_count_general / num_rows} ")
    print(f"Average like_count is  {like_count_general / num_rows} ")
    print(f"Average quote_count is  {quote_count_general / num_rows} ")

    print("===================================")


def aksener_refugees_tweets_reactions():
    # Replace 'file_path' with the actual path to your Excel file
    df = pd.read_excel('/Users/AyseEsra/Desktop/FilteredTweets/Refugees/Aksener/AksenerFilteredTweets.xlsx')

    retweet_count_general = 0
    reply_count_general = 0
    like_count_general = 0
    quote_count_general = 0

    # Iterate over each row in the Excel file
    for index, row in df.iterrows():
        retweet_count = row['retweet_count']
        reply_count = row['reply_count']
        like_count = row['like_count']
        quote_count = row['quote_count']

        retweet_count_general += retweet_count
        reply_count_general += reply_count
        like_count_general += like_count
        quote_count_general += quote_count

    num_rows = df.shape[0]

    print("Aksener Refugees Reactions")
    print(f"Average retweet_count is  {retweet_count_general / num_rows} ")
    print(f"Average reply_count is  {reply_count_general / num_rows} ")
    print(f"Average like_count is  {like_count_general / num_rows} ")
    print(f"Average quote_count is  {quote_count_general / num_rows} ")

    print("===================================")

def ozdag_refugees_tweets_reactions():
    # Replace 'file_path' with the actual path to your Excel file
    df = pd.read_excel('/Users/AyseEsra/Desktop/FilteredTweets/Refugees/Ozdag/OzdagFilteredTweets.xlsx')

    retweet_count_general=0
    reply_count_general=0
    like_count_general=0
    quote_count_general=0

    # Iterate over each row in the Excel file
    for index, row in df.iterrows():
        retweet_count = row['retweet_count']
        reply_count = row['reply_count']
        like_count = row['like_count']
        quote_count = row['quote_count']

        retweet_count_general += retweet_count
        reply_count_general += reply_count
        like_count_general += like_count
        quote_count_general += quote_count

    num_rows = df.shape[0]

    print("Ozdag Refugees Reactions")
    print(f"Average retweet_count is  {retweet_count_general / num_rows } ")
    print(f"Average reply_count is  {reply_count_general / num_rows} ")
    print(f"Average like_count is  {like_count_general / num_rows} ")
    print(f"Average quote_count is  {quote_count_general / num_rows} ")
    print("===================================")


def bahceli_nationalism_tweets_reactions():
    # Replace 'file_path' with the actual path to your Excel file
    df = pd.read_excel('/Users/AyseEsra/Desktop/FilteredTweets/Nationalism/Bahceli/BahceliFilteredTweets_Nationalism.xlsx')

    retweet_count_general = 0
    reply_count_general = 0
    like_count_general = 0
    quote_count_general = 0

    # Iterate over each row in the Excel file
    for index, row in df.iterrows():
        retweet_count = row['retweet_count']
        reply_count = row['reply_count']
        like_count = row['like_count']
        quote_count = row['quote_count']

        retweet_count_general += retweet_count
        reply_count_general += reply_count
        like_count_general += like_count
        quote_count_general += quote_count

    num_rows = df.shape[0]

    print("Bahceli Nationalism Reactions")
    print(f"Average retweet_count is  {retweet_count_general / num_rows} ")
    print(f"Average reply_count is  {reply_count_general / num_rows} ")
    print(f"Average like_count is  {like_count_general / num_rows} ")
    print(f"Average quote_count is  {quote_count_general / num_rows} ")
    print("===================================")

def aksener_nationalism_tweets_reactions():
    # Replace 'file_path' with the actual path to your Excel file
    df = pd.read_excel(
        '/Users/AyseEsra/Desktop/FilteredTweets/Nationalism/Aksener/AksenerFilteredTweets_Nationalism.xlsx')

    retweet_count_general = 0
    reply_count_general = 0
    like_count_general = 0
    quote_count_general = 0

    # Iterate over each row in the Excel file
    for index, row in df.iterrows():
        retweet_count = row['retweet_count']
        reply_count = row['reply_count']
        like_count = row['like_count']
        quote_count = row['quote_count']

        retweet_count_general += retweet_count
        reply_count_general += reply_count
        like_count_general += like_count
        quote_count_general += quote_count

    num_rows = df.shape[0]

    print("Aksener Nationalism Reactions")
    print(f"Average retweet_count is  {retweet_count_general / num_rows} ")
    print(f"Average reply_count is  {reply_count_general / num_rows} ")
    print(f"Average like_count is  {like_count_general / num_rows} ")
    print(f"Average quote_count is  {quote_count_general / num_rows} ")
    print("===================================")

def ozdag_nationalism_tweets_reactions():
    # Replace 'file_path' with the actual path to your Excel file
    df = pd.read_excel(
        '/Users/AyseEsra/Desktop/FilteredTweets/Nationalism/Ozdag/OzdagFilteredTweets_Nationalism.xlsx')

    retweet_count_general = 0
    reply_count_general = 0
    like_count_general = 0
    quote_count_general = 0

    # Iterate over each row in the Excel file
    for index, row in df.iterrows():
        retweet_count = row['retweet_count']
        reply_count = row['reply_count']
        like_count = row['like_count']
        quote_count = row['quote_count']

        retweet_count_general += retweet_count
        reply_count_general += reply_count
        like_count_general += like_count
        quote_count_general += quote_count

    num_rows = df.shape[0]

    print("Ozdag Nationalism Reactions")
    print(f"Average retweet_count is  {retweet_count_general / num_rows} ")
    print(f"Average reply_count is  {reply_count_general / num_rows} ")
    print(f"Average like_count is  {like_count_general / num_rows} ")
    print(f"Average quote_count is  {quote_count_general / num_rows} ")
    print("===================================")

def all_tweet_reactions():
    # Replace 'file_path' with the actual path to your Excel file
    df_bahceli = pd.read_excel('/Users/AyseEsra/Desktop/tweets.xlsx', sheet_name='Devlet Bahceli - All')
    df_aksener = pd.read_excel('/Users/AyseEsra/Desktop/tweets.xlsx', sheet_name='Meral Aksener - All')
    df_ozdag = pd.read_excel('/Users/AyseEsra/Desktop/tweets.xlsx', sheet_name='Umit Ozdag - All')


    bahceli_retweet_count_general = 0
    bahceli_reply_count_general = 0
    bahceli_like_count_general = 0
    bahceli_quote_count_general = 0

    aksener_retweet_count_general = 0
    aksener_reply_count_general = 0
    aksener_like_count_general = 0
    aksener_quote_count_general = 0

    ozdag_retweet_count_general = 0
    ozdag_reply_count_general = 0
    ozdag_like_count_general = 0
    ozdag_quote_count_general = 0

    # Iterate over each row in the Excel file
    for index, row in df_bahceli.iterrows():
        retweet_count = row['retweet_count']
        reply_count = row['reply_count']
        like_count = row['like_count']
        quote_count = row['quote_count']

        bahceli_retweet_count_general += retweet_count
        bahceli_reply_count_general += reply_count
        bahceli_like_count_general += like_count
        bahceli_quote_count_general += quote_count

    # Iterate over each row in the Excel file
    for index, row in df_aksener.iterrows():
        retweet_count = row['retweet_count']
        reply_count = row['reply_count']
        like_count = row['like_count']
        quote_count = row['quote_count']

        aksener_retweet_count_general += retweet_count
        aksener_reply_count_general += reply_count
        aksener_like_count_general += like_count
        aksener_quote_count_general += quote_count

    # Iterate over each row in the Excel file
    for index, row in df_ozdag.iterrows():
        retweet_count = row['retweet_count']
        reply_count = row['reply_count']
        like_count = row['like_count']
        quote_count = row['quote_count']

        ozdag_retweet_count_general += retweet_count
        ozdag_reply_count_general += reply_count
        ozdag_like_count_general += like_count
        ozdag_quote_count_general += quote_count


    num_rows_bahceli = df_bahceli.shape[0]
    num_rows_aksener = df_aksener.shape[0]
    num_rows_ozdag = df_ozdag.shape[0]

    print("Bahceli All Tweet Reactions")
    print(f"Average retweet_count is  {bahceli_retweet_count_general / num_rows_bahceli} ")
    print(f"Average reply_count is  {bahceli_reply_count_general / num_rows_bahceli} ")
    print(f"Average like_count is  {bahceli_like_count_general / num_rows_bahceli} ")
    print(f"Average quote_count is  {bahceli_quote_count_general / num_rows_bahceli} ")
    print("===================================")

    print("Aksener All Tweet Reactions")
    print(f"Average retweet_count is  {aksener_retweet_count_general / num_rows_aksener} ")
    print(f"Average reply_count is  {aksener_reply_count_general / num_rows_aksener} ")
    print(f"Average like_count is  {aksener_like_count_general / num_rows_aksener} ")
    print(f"Average quote_count is  {aksener_quote_count_general / num_rows_aksener} ")
    print("===================================")

    print("Ozdag All Tweet Reactions")
    print(f"Average retweet_count is  {ozdag_retweet_count_general / num_rows_ozdag} ")
    print(f"Average reply_count is  {ozdag_reply_count_general / num_rows_ozdag} ")
    print(f"Average like_count is  {ozdag_like_count_general / num_rows_ozdag} ")
    print(f"Average quote_count is  {ozdag_quote_count_general / num_rows_ozdag} ")


# Press the green button in the gutter to run the script.
if __name__ == '__main__':

    #refugees reactions
    bahceli_refugees_tweets_reactions()
    aksener_refugees_tweets_reactions()
    ozdag_refugees_tweets_reactions()


    #nationalism reactions
    bahceli_nationalism_tweets_reactions()
    aksener_nationalism_tweets_reactions()
    ozdag_nationalism_tweets_reactions()

    #all tweet reactions
    all_tweet_reactions()



# See PyCharm help at https://www.jetbrains.com/help/pycharm/




